/************************************* * File: exRect.cpp * Author: Katherine Gibson * Date: 2/18/2016 * Section: N/A * E-mail: k38@umbc.edu * Description: * This file contains a main() that * uses the Rectangle class *************************************/ #include "Rectangle.h" #include using namespace std; int main() { Rectangle defaultRect; Rectangle square(5, 5); Rectangle tallBlue(5, 30, "aquamarine"); // The two calls to the constructor below don't work... // Rectangle redRect("red"); // Rectangle blueRect(7, "blue"); /* We actually cannot do this! Default parameters are invoked starting from the right. That means for both of these, we are trying to set width (in the first case) or height (in the second case) to be a string. If we wanted to create a 'default' red rectangle, we would need to actually create an overloaded constructor that only took in color: Rectangle::Rectangle (string color); or something similar. Using overloaded functions and default parameters can be tricky, so you need to pay attention to what you are doing and why. */ cout << endl << "Information on the default rectangle:" << endl; defaultRect.PrintInfo(); cout << endl << "Information on a square rectangle:" << endl; square.PrintInfo(); cout << endl << "Information on a tall blue rectangle:" << endl; tallBlue.PrintInfo(); // update the color and width of the default rectangle defaultRect.SetColor("chartreuse"); defaultRect.SetWidth(15); cout << endl << endl << "Information on the default rectangle after updating:" << endl; defaultRect.PrintInfo(); cout << endl << endl; return 0; }